﻿//07.Write a program that gets a number n and after that 
//gets n more numbers and calculates and prints their sum.

using System;

namespace CalculateSum
{
    class Sum
    {
        static void Main()
        {
            Console.Write("Please define how many numbers to enter and calculate their sum: ");
            int n = int.Parse(Console.ReadLine());

            int x = 0;
            int sum = 0;

            if (n <= 0)
            {
                Console.WriteLine("Your number should be greater than {0}.", n);
            }
            else
            {
                for (int i = 0; i < n; ++i)
                {
                    Console.Write("Please enter a number: ");
                    x = int.Parse(Console.ReadLine());
                    sum = sum + x;
                }
                Console.WriteLine("The sum is {0}.", sum);
            }
        }
    }
}
